package com.alks.function.controller.finance.costcheck;


import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.dto.finance.costcheck.PcLotHeadDto;
import com.alks.function.data.request.finance.costcheck.LotCostRequest;
import com.alks.function.data.request.finance.costcheck.LotCostUpdateBatchRequest;
import com.alks.function.data.request.finance.costcheck.LotCostUpdateRequest;
import com.alks.function.service.finance.costcheck.PcLotCostService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;


@Slf4j
@Api(value = "财务部-成本核算作业-指令成本作业", tags = {"财务部-指令成本作业"})
@ApiRestController("/pcLotCost")
@RoleCheck(prgIds = {"180401"})
public class PcLotCostController {

    @Autowired
    PcLotCostService pcLotCostService;


    @PostMapping("/getNotCompleteLotDetail")
    @ApiOperation(value = "未完工指令明细",tags = "财务部-指令成本作业")
    public ResponseInfo getNotCompleteLotDetail(@RequestBody LotCostRequest request) {
        return pcLotCostService.getNotCompleteLotDetail(request);
    }

    @PostMapping("/getCompleteLotDetail")
    @ApiOperation(value = "完工指令明细",tags = "财务部-指令成本作业")
    public ResponseInfo getCompleteLotDetail(@RequestBody LotCostRequest request) {
        return pcLotCostService.getCompleteLotDetail(request);
    }

    @PostMapping("/updateCostBatch")
    @ApiOperation(value = "费用更新",tags = "财务部-指令成本作业")
    public ResponseInfo updateCostBatch(@RequestBody LotCostUpdateBatchRequest request) {
        return pcLotCostService.updateCostBatch(request);
    }

    @PostMapping("/updateCost")
    @ApiOperation(value = "普通更新",tags = "财务部-指令成本作业")
    public ResponseInfo updateCost(@RequestBody LotCostUpdateRequest request) {
        return pcLotCostService.updateCost(request);
    }

    @PostMapping("/sealAccount")
    @ApiOperation(value = "封账批处理",tags = "财务部-指令成本作业")
    public ResponseInfo sealAccount(@RequestBody List<String> lotNoList) {
        return pcLotCostService.sealAccount(lotNoList);
    }

    @PostMapping("/cancelSealAccount")
    @ApiOperation(value = "取消封账",tags = "财务部-指令成本作业")
    public ResponseInfo cancelSealAccount(@RequestBody List<String> lotNoList) {
        return pcLotCostService.cancelSealAccount(lotNoList);
    }

    @PostMapping("/deleteCostBatch")
    @ApiOperation(value = "完工删除",tags = "财务部-指令成本作业")
    public ResponseInfo deleteCostBatch(@RequestBody List<String> lotNoList) {
        return pcLotCostService.deleteCostBatch(lotNoList);
    }

    @PostMapping("/addCostBatch")
    @ApiOperation(value = "插入计算",tags = "财务部-指令成本作业")
    public ResponseInfo addCostBatch(@RequestBody List<PcLotHeadDto> request, @RequestParam int flag) {
        return pcLotCostService.addCostBatch(request,flag);
    }
}
